<template>
	<view class="main" :style="'top:'+(-demo.height-demo.top-10)+'px'">
		<view :style="'padding-top:'+(demo.height+demo.top+10)+'px'">
			<head1 class="nav_top"
				:style="'height:' +  demo.height + 'px;' + 'padding-top:' + demo.top + 'px;padding-bottom:10px'"
				:nav="title">
			</head1>
		</view>
		<view class="mainDetail">
			<view class="mainDiv" v-for="(item,index) in dataList" :key='index'>
				<view class="tit"><text>日志内容：</text>{{item.logmemo}}</view>
				<view class="time"><text>操作时间：</text>{{item.logtime}}</view>
			</view>
		</view>
		<view v-if="dataList.length==0" class="meishuju">
			{{meishuju}}
		</view>
	</view>
</template>

<script>
	import head1 from '../head/head.vue'
	export default {
		components: {
			head1
		},
		data() {
			return {
				userId: '',
				title: '证书动态',
				meishuju: '',
				demo: {
					top: '',
					height: ''
				},
				dataList: []
			}
		},
		onLoad(options) {
			console.log('klll')
			console.log(options)
			// 获取身份证号
			let sfzh = uni.getStorageSync('userSfzh')
			this.getDetail(options.item, sfzh)
		},
		created() {
			const demo = uni.getMenuButtonBoundingClientRect()
			this.demo.top = demo.top
			this.demo.height = demo.height
		},
		methods: {
			getDetail(id, sfzh) {
				let _this=this;
				uni.showLoading({
					title:'加载中...'
				})
				setTimeout(function(){
					_this.$myResquest.getHistory({
						userId: id,
						sfzh: sfzh
					}).then(res => {
						if (res.data.code == 200) {
							_this.dataList = JSON.parse(res.data.data)
							if(_this.dataList.length==0){
								_this.meishuju='暂无动态信息'
							}
							uni.hideLoading()
						}
					})
					uni.hideLoading()
				},1000)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.meishuju {
		width: 750rpx;
		text-align: center;
		height: 250rpx;
		line-height: 250rpx;
	}
	.mainDetail{
		padding: 20rpx;
		box-sizing: border-box;
		.mainDiv{
			margin: 20rpx 0;
			.tit{
				line-height: 50rpx;
				color: #999999;
				text{
					color: #000000;
				}
			}
			.time{
			line-height: 50rpx;	
			color: #999999;
			text{
				color: #000000;
			}
			}
		}
	}
	
</style>
